package com.grant.code.config;

import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextClosedEvent;

@Configuration
public class AppConfig {
    
    @Bean
    public ApplicationListener<ContextClosedEvent> contextClosedListener() {
        return event -> {
            System.out.println("Spring 上下文正在关闭...");
            // 执行其他清理操作（如关闭数据库连接池）
        };
    }
}